home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-18 | 1.4 KB | 50 lines | [TEXT/CWIE] |
- // GWorldAccessor.cp, the GWorldAccessor class, to be used for direct access to
- // GWorld pixel-maps.
-
- // copyright © 1995, Macneil Shonle. All rights reserved.
-
- #ifndef __GWORLDACCESSOR__
- #include <GWorldAccessor.h>
- #endif
-
- // sets up direct blitting information for an offscreen graphics world
- // may throw: xalloc
- GWorldAccessor::GWorldAccessor(GWorldPtr gw) throw(xalloc)
- {
- construct(gw);
- }
-
- // intentionally left blank
- GWorldAccessor::~GWorldAccessor()
- {
- }
-
- // makes a copy of the given GWorldAccessor
- // may throw: xalloc
- GWorldAccessor& GWorldAccessor::operator=(const GWorldAccessor& gwa) throw(xalloc)
- {
- this->BufferAccessor::operator=(gwa);
- return *this;
- }
-
- // caches in the given GWorld's pixel information
- // may throw: xalloc
- GWorldAccessor& GWorldAccessor::operator=(GWorldPtr gw) throw(xalloc)
- {
- construct(gw);
- return *this;
- }
-
- // private member-function to implement the construction of the BufferAccessor for
- // an offscreen graphics world
- // may throw: xalloc
- void GWorldAccessor::construct(GWorldPtr gw) throw(xalloc)
- {
- theHeight = gw->portRect.bottom - gw->portRect.top;
- theWidth = gw->portRect.right - gw->portRect.left;
-
- PixMapHandle gwPixMap = ::GetGWorldPixMap(gw);
- theRowBytes = (*gwPixMap)->rowBytes & 0x3FFFL; // see QD 15-RowBytes Revealed II
- setArray(PixelPtr(::GetPixBaseAddr(gwPixMap)), theRowBytes, theHeight);
- mmuMode = ::PixMap32Bit(gwPixMap);
- }